Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

O3-4357: Add Allergy Recording to Patient Visit Scenario #54

Merged
merged 8 commits into from
Jan 22, 2025

Conversation

Bawanthathilan
Copy link
Collaborator

@Bawanthathilan Bawanthathilan commented Jan 20, 2025

This pull request introduces the following changes to enhance the patient visit scenario by incorporating allergy recording functionality:

  • The patient visit scenario is updated to include allergy recording functionality.

  • Allergy recording action is implemented in the DoctorRegistry.java file.

  • Relevant HTTP requests for allergy recording are added to the DoctorHttpService.java file.

Ticket URL:
O3-4357: Enhance Patient Visit with Allergy Recording

Copy link
Member

@jayasanka-sack jayasanka-sack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for subbiting the draft pr @Bawanthathilan! 🎉 I’ve added a few comments. Take a peek and let me know if you have any questions.

Copy link
Member

@jayasanka-sack jayasanka-sack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Bawanthathilan , getting close! See my updated thoughts/questions.



return http("Save Allergies of Patient")
.get("/openmrs/ws/rest/v1/patient/"+ patientUuid +"/allergy")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.get("/openmrs/ws/rest/v1/patient/"+ patientUuid +"/allergy")
.post("/openmrs/ws/rest/v1/patient/"+ patientUuid +"/allergy")

payload.put("reactions", reactions);


return http("Save Allergies of Patient")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return http("Save Allergies of Patient")
return http("Save an Allergy")


public HttpRequestActionBuilder getAllergies(String patientUuid) {
return http("Get Allergies of Patient")
.get("/openmrs/ws/fhir2/R4/AllergyIntolerance?patient=" + patientUuid + "&_summary=data");
}

public HttpRequestActionBuilder GetDrugAllergens(String drugAllergenUuid) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public HttpRequestActionBuilder GetDrugAllergens(String drugAllergenUuid) {
public HttpRequestActionBuilder getDrugAllergens(String drugAllergenUuid) {

Method names should be named in lower camel case (starts with a lowercase).

Comment on lines 180 to 183
public HttpRequestActionBuilder GetEnvironmentAllergens(String environmentalAllergenUuid) {
return http("Get Environment Allergens")
.get("/openmrs/ws/rest/v1/concept/" + environmentalAllergenUuid + "?v=full");
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's the same API call, how about we make it a single call and use the passed parameter?

ex:

getAllergens(environmentalAllergenUuid),
getAllergens(drugAllergenUuid),
...

Map<String, Object> payload = new HashMap<>();

Map<String,String> codedAllergen = new HashMap<>();
codedAllergen.put("uuid", "71617AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make the UUID a constant and move it to the Constants.java file. That way it’ll be super clear what this UUID is for and we can easily reuse it in other parts of the code.

@@ -29,6 +29,8 @@ public ScenarioBuilder getScenarioBuilder() {
.exec(registry.openOrdersTab("#{patient_uuid}"))
.exec(registry.openLabResultsTab("#{patient_uuid}"))
.exec(registry.openAllergiesTab("#{patient_uuid}"))
.exec(registry.OpenAllergiesForm())
.exec(registry.addAllergies("#{patient_uuid}"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.exec(registry.addAllergies("#{patient_uuid}"))
.exec(registry.recordAllergy("#{patient_uuid}"))

Comment on lines 99 to 102
String drugAllergenUuid = "162555AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
String environmentalAllergenUuid = "162552AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
String foodAllergenUuid = "162554AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
String allergyReactionUuid = "162553AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let’s add this to the constants.java file too.

@@ -148,11 +152,78 @@ public HttpRequestActionBuilder getDrugOrders(String patientUuid) {
"&status=any&orderType=" + DRUG_ORDER +
"&v=" + customRepresentation);
}

public HttpRequestActionBuilder searchPatient(String searchQuery) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused method

.get("/openmrs/ws/rest/v1/concept/" + allergyReactionUuid + "?v=full");
}

public HttpRequestActionBuilder saveAllergies(String patientUuid) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public HttpRequestActionBuilder saveAllergies(String patientUuid) {
public HttpRequestActionBuilder saveAllergy(String patientUuid) {

@jayasanka-sack jayasanka-sack changed the title O3-4357:Add Allergy Recording to Patient Visit Scenario O3-4357: Add Allergy Recording to Patient Visit Scenario Jan 21, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@Bawanthathilan
Copy link
Collaborator Author

This pull request introduces the following changes to enhance the patient visit scenario by incorporating allergy recording functionality:

  • The patient visit scenario is updated to include allergy recording functionality.

  • Allergy recording action is implemented in the DoctorRegistry.java file.

  • Relevant HTTP requests for allergy recording are added to the DoctorHttpService.java file.

payload.put("reactions", reactions);

try{
return http("Save an Allergies")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return http("Save an Allergies")
return http("Save an Allergy")


public HttpRequestActionBuilder getAllergies(String patientUuid) {
public HttpRequestActionBuilder GetAllergies(String patientUuid) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public HttpRequestActionBuilder GetAllergies(String patientUuid) {
public HttpRequestActionBuilder getAllergies(String patientUuid) {

Method names should be named in lower camel case (starts with a lowercase).

@@ -147,11 +154,54 @@ public HttpRequestActionBuilder getDrugOrders(String patientUuid) {
"&careSetting=" + CARE_SETTING_UUID +
"&status=any&orderType=" + DRUG_ORDER +
"&v=" + customRepresentation);
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}


// Allergies
public static final String DRUG_ALLERGEN_UUID = "162555AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
public static final String ENVIRONMENTAL_ALLERGEN_UUID = "162552AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public static final String ENVIRONMENTAL_ALLERGEN_UUID = "162552AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
public static final String ENVIRONMENTAL_ALLERGEN_UUID = "162552AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";

@@ -29,6 +29,8 @@ public ScenarioBuilder getScenarioBuilder() {
.exec(registry.openOrdersTab("#{patient_uuid}"))
.exec(registry.openLabResultsTab("#{patient_uuid}"))
.exec(registry.openAllergiesTab("#{patient_uuid}"))
.exec(registry.OpenAllergiesForm())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.exec(registry.OpenAllergiesForm())
.exec(registry.openAllergiesForm())

Comment on lines 195 to 204
try{
return http("Save an Allergy")
.post("/openmrs/ws/rest/v1/patient/"+ patientUuid +"/allergy")
.body(StringBody(new ObjectMapper().writeValueAsString(payload)));
}catch (JsonProcessingException e) {
throw new RuntimeException(e);
}



Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
try{
return http("Save an Allergy")
.post("/openmrs/ws/rest/v1/patient/"+ patientUuid +"/allergy")
.body(StringBody(new ObjectMapper().writeValueAsString(payload)));
}catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
try{
return http("Save an Allergy")
.post("/openmrs/ws/rest/v1/patient/"+ patientUuid +"/allergy")
.body(StringBody(new ObjectMapper().writeValueAsString(payload)));
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}

Comment on lines 41 to 44
public static final String FOOD_ALLERGEN_UUID = "162554AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
public static final String ALLERGY_REACTION_UUID = "162553AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
public static final String CODED_ALLERGEN_UUID = "71617AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
public static final String SEVERITY_UUID = "1498AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an extra space here.

@@ -152,6 +159,49 @@ public HttpRequestActionBuilder getDrugOrders(String patientUuid) {
public HttpRequestActionBuilder getAllergies(String patientUuid) {
return http("Get Allergies of Patient")
.get("/openmrs/ws/fhir2/R4/AllergyIntolerance?patient=" + patientUuid + "&_summary=data");
}

public HttpRequestActionBuilder getAllergen(String allergenType, String allergenUuid) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public HttpRequestActionBuilder getAllergen(String allergenType, String allergenUuid) {
public HttpRequestActionBuilder getAllergens(String allergenType, String allergenUuid) {

Copy link
Member

@jayasanka-sack jayasanka-sack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thank you so much for getting this done, @Bawanthathilan! 🎉

@jayasanka-sack jayasanka-sack marked this pull request as ready for review January 22, 2025 01:36
@jayasanka-sack jayasanka-sack merged commit aef1ebc into openmrs:main Jan 22, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants